﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

/*
    2012-2-17 David检查正常
 */
namespace Benefit.Models.Sys
{
    /// <summary>
    /// 每日小组，组长关系
    /// </summary>
    public class DayGroupMaster
    {
        public int Id { get; set; }

        public int GroupId { get; set; }

        public virtual Groups Group { get; set; }

        public int MasterId { get; set; }

        public virtual Operator Master { get; set; }

        public DateTime Pdate { get; set; }


        ///// <summary>
        ///// 初始化每天的小组人员关系
        ///// </summary>
        //public void InitDayGroupMaster(DateTime pdate, DB.DBManager db)
        //{
        //    var query = from t in db.GroupMaster.Include(a => a.Master).Include(a => a.Group) select t;
        //    foreach (Sys.GroupMaster o in query)
        //    {
        //        if (!o.Group.IsDeleted && !o.Master.IsDeleted)
        //        {
        //            DayGroupMaster dgop = new DayGroupMaster();
        //            dgop.Pdate = pdate;
        //            dgop.GroupId = o.GroupId;
        //            dgop.MasterId = o.MasterId;
        //            db.DayGroupMaster.Add(dgop);
        //        }
        //    }
        //    db.SaveChanges();
        //}
        ///// <summary>
        ///// 删除某天的小组，组长关系
        ///// </summary>
        ///// <param name="pdate"></param>
        //public void DeleteDayGroupMaster(DateTime pdate, DB.DBManager db)
        //{
        //    var query = from t in db.DayGroupMaster where t.Pdate.Year == pdate.Year && t.Pdate.Month == pdate.Month && t.Pdate.Day == pdate.Day select t;
        //    foreach (Sys.DayGroupMaster o in query)
        //    {
        //        db.DayGroupMaster.Remove(o);
        //    }
        //    db.SaveChanges();
        //}
    }
}
